
extends Node
func _init():
	pass

func loadBuff(name, lv = 0):
	if lv > 0:
		return get(name).new(lv)
	return get(name).new()

var buffTemplates = [
	{
		"name":"聚能环",
		"desc":"我方舰娘获得的护盾提高100%",
		"id":1,
		"debuff":false,
		"instant":true,#是否立即生效
		"num":2,
		"onBattleStart":false,
	},
	{
		"name":"永恒信物",
		"desc":"随机获得一个3级限定舰娘",
		"id":2,
		"debuff":false,
		"instant":true,#是否立即生效
		"onBattleStart":false,
	},
	{
		"name":"霜之哀伤",
		"desc":"霜冻效果还会降低敌方单位的炮击雷击航空",
		"id":3,
		"debuff":false,
		"instant":true,#是否立即生效
		"onBattleStart":false,
	},
	{
		"name":"火之高兴",
		"desc":"烧蚀效果还会降低敌方单位的炮击雷击航空",
		"id":4,
		"debuff":false,
		"instant":true,#是否立即生效
		"onBattleStart":false,
	},
	{
		"name":"招财猫",
		"desc":"每回合获得20金币",
		"id":5,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
	},
	{
		"name":"聚宝盆",
		"desc":"每回合获得15魔方",
		"id":6,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
	},
	{
		"name":"意大利炮",
		"desc":"我方战列舰娘伤害提高35%",
		"id":7,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"shipType":[sys.CharaClass.BB],
		"loopAlly":true,
	},
	{
		"name":"酸素可乐",
		"desc":"我方驱逐舰娘伤害提高35%",
		"id":8,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"shipType":[sys.CharaClass.DD],
		"loopAlly":true,
	},
	{
		"name":"海军咖喱",
		"desc":"我方巡洋舰娘伤害提高35%",
		"id":9,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"shipType":[sys.CharaClass.CL, sys.CharaClass.CA],
		"loopAlly":true,
	},
	{
		"name":"弹射器",
		"desc":"我方航母/轻航舰娘冷却提高35%",
		"id":10,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"shipType":[sys.CharaClass.CV, sys.CharaClass.CVL],
		"loopAlly":true,
	},
	{
		"name":"小扳手",
		"desc":"我方辅助舰娘冷却提高35%",
		"id":11,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"shipType":[sys.CharaClass.SUP],
		"loopAlly":true,
	},
	{
		"name":"仰望星空",
		"desc":"我方舰娘造成的伤害提高30%，受到的伤害提高15%",
		"id":12,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"辣子鸡丁",
		"desc":"我方舰娘暴击降低10%，暴击伤害提高50%",
		"id":13,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"塞壬研究档案",
		"desc":"敌方普通塞壬战斗开始时损失40%血量",
		"id":15,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopEnemy":true,
	},
	{
		"name":"飞龙探云手",
		"desc":"击杀敌方单位时，有1%概率偷取目标身上的装备",
		"id":16,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"浓缩魔方",
		"desc":"获得一名随机传奇舰娘",
		"id":20,
		"debuff":false,
		"instant":true,#是否立即生效
	},
	{
		"name":"白嫖怪",
		"desc":"每次进化舰娘有15%几率不消耗布里",
		"id":23,
		"debuff":false,
		"instant":true,#是否立即生效
	},
	{
		"name":"粒子光矛",
		"desc":"我方舰娘对塞壬伤害提高50%",
		"id":24,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"Fa♂国巨炮",
		"desc":"每回合开始时，随机对敌方等级最高的非塞壬单位造成[目标血上限100%]的真实伤害",
		"id":26,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
	},
	{
		"name":"亡者之歌",
		"desc":"每12秒触发我方所有角色的亡语效果",
		"id":30,
		"debuff":false,
		"instant":false,#是否立即生效
		"loopAlly":true,
		"onBattleStart":true,
	},
	{
		"name":"金属探测器",
		"desc":"我方舰娘阵亡时，获得12金币",
		"id":31,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"结界发生器",
		"desc":"我方舰娘战斗开始时获得3秒<无敌>",
		"id":35,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"酸素鱼雷",
		"desc":"我方驱逐舰娘，造成雷击/技能伤害时，有10%概率变为真实伤害",
		"id":40,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"水鬼",
		"desc":"敌方受到漏水效果伤害时，额外受到[血上限4%]的真实伤害",
		"id":41,
		"debuff":false,
		"instant":true,
	},
	{
		"name":"限流阀",
		"desc":"我方[非召唤]角色，单次受到的伤害不超过血上限[55%]",
		"id":43,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
	{
		"name":"王牌机组",
		"desc":"我方舰载机获得30%减伤(乘算)",
		"id":44,
		"debuff":false,
		"instant":false,#是否立即生效
		"onBattleStart":true,
		"loopAlly":true,
	},
]
#限流阀
class b_rel_xianliufa:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		dispel = 2
		id = "b_rel_xianliufa"	
	func _connect():
		masCha.connect("onHurt", self, "onHurt")
	func onHurt(atkInfo):
		if atkInfo.hurtVal > masCha.att.maxHp * 0.6:
			atkInfo.hurtVal = masCha.att.maxHp * 0.6
#王牌机组
class b_rel_wangpaijz:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_wangpaijz"	
		dispel = 2
	func _connect():
		masCha.connect("summChara", self, "summChara")
	func summChara(cha):
		cha.connect("onHurt", self, "onHurt")
	func onHurt(atkInfo):
		atkInfo.hurtVal *= 0.7

#仰望星空
class b_rel_ywxk:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_ywxk"	
		att.atkR = 0.3
		att.defR = -0.15
		dispel = 2

#辣子鸡丁
class b_rel_lzjd:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_lzjd"	
		att.cri = -0.1
		att.criR = 0.5
		dispel = 2

#飞龙探云手
class b_rel_fltys:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_fltys"	
		dispel = 2
	func _connect():
		masCha.connect("onKillChara", self, "onKillChara")
	func onKillChara(atkInfo):
		if not atkInfo.hitCha.items.empty() and sys.rndPer(1):
			for i in atkInfo.hitCha.items:
				sys.main.player.addItem(sys.newItem(i.id))

#粒子光矛
class b_rel_lzgm:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_lzgm"
		dispel = 2
	func _connect():
		masCha.connect("onAtkChara",self,"_onAtkChara")
	func _onAtkChara(atkInfo:AtkInfo):
		if atkInfo.hitCha.get("camp") == "塞壬":
			atkInfo.factor += 0.5

#金属探测器
class b_rel_jstcq:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_jstcq"	
		dispel = 2
	func _connect():
		masCha.connect("onDeath",self,"_onDeath")
	func _onDeath(atkInfo):
		sys.main.player.plusGold(12)
		isDel = true

#圣经
class b_rel_shengJ:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_shengJ"	
		dispel = 2
	func _connect():
		masCha.connect("onAtkChara",self,"_onAtkChara")
	func _onAtkChara(atkInfo):
		if atkInfo.hurtVal > 0 and atkInfo.hitCha.team != masCha.team and sys.rndPer(10):	
			atkInfo.hurtType = sys.HurtType.REAL
			atkInfo.hurtVal = atkInfo.atkVal

#亡者之歌
class b_rel_wangzhe:
	extends "../azurlane_ctrl/AzurBuff.gd"
	func _init():
		attInit()
		id = "b_rel_wangzhe"	
		dispel = 2
	var index = 0
	func _upS():
		index += 1
		if index >= 12 and not masCha.isDeath:
			index = 0
			masCha.deathWord()